package com.manli.api.controller;

import java.util.Arrays;
import java.util.Map;
import com.manli.api.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.manli.api.base.annotation.Permissions;
import com.manli.api.pojo.QueryParams;
import com.manli.api.dto.VisitWantToBuyLog;
import com.manli.api.service.VisitWantToBuyLogService;

import javax.servlet.http.HttpServletRequest;


/**
 * 浏览产品预购表
 *
 * @author manli
 * @email 
 * @date 2020-07-17 22:33:08
 */
@Api(value="/visitwanttobuylog", tags="浏览产品预购表")
@RestController
@RequestMapping("api/visitwanttobuylog")
public class VisitWantToBuyLogController {
    @Autowired
    private VisitWantToBuyLogService visitWantToBuyLogService;

    /**
     * 列表
     */
    @ApiOperation(value = "浏览产品预购表列表",notes = "")
    @PostMapping("/list")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result list(@RequestBody QueryParams params){
        return visitWantToBuyLogService.queryPage(params);
    }

    /**
     * 全部数据信息
     */
    @ApiOperation(value = "浏览产品预购表全部数据信息",notes = "")
    @PostMapping("/all")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result all(){
        return visitWantToBuyLogService.queryAll();
    }

    /**
     * 单条信息
     */
    @ApiOperation(value = "浏览产品预购表单条信息",notes = "浏览产品预购表单条信息")
    @GetMapping("/info/{visitWantToBuyLogId}")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result info(@PathVariable("visitWantToBuyLogId") Integer visitWantToBuyLogId){
        return visitWantToBuyLogService.getById(visitWantToBuyLogId);
    }

    /**
     * 保存
     */
    @ApiOperation(value = "浏览产品预购表保存",notes = "浏览产品预购表保存")
    @PostMapping("/save")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result save(@RequestBody VisitWantToBuyLog visitWantToBuyLog, HttpServletRequest request){
        return visitWantToBuyLogService.save(visitWantToBuyLog,request);
    }

    /**
     * 修改
     */
    @ApiOperation(value = "浏览产品预购表修改",notes = "浏览产品预购表修改")
    @PostMapping("/update")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result update(@RequestBody VisitWantToBuyLog visitWantToBuyLog){
        return visitWantToBuyLogService.updateById(visitWantToBuyLog);
    }


    /**
     * 删除多条数据
     */
    @ApiOperation(value = "浏览产品预购表删除",notes = "浏览产品预购表删除")
    @ApiImplicitParam(name = "visitWantToBuyLogIds", value = "id数组,json字符串",dataType = "id数组,json字符串", required = true)
    @PostMapping("/deleteIds")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result deleteIds(@RequestBody Integer[] visitWantToBuyLogIds){
        return visitWantToBuyLogService.removeByIds(Arrays.asList(visitWantToBuyLogIds));
    }

}
